/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thinkinginjava.svn.typeinformation;

/**
 *
 * @author public_enemy
 */
class Base {
}

class Derived extends Base {
}

public class FamilyVsExactType {

    static void test(Object x) {
        System.out.println("Testing x type: " + x.getClass());
        System.out.println("x instanceof Base: " + (x instanceof Base));
        System.out.println("x instanceof Derived: " + (x instanceof Derived));
        System.out.println("");
        System.out.println("x isInstance Base: " + (Base.class.isInstance(x)));
        System.out.println("x isInstance Derived: " + (Derived.class.isInstance(x)));
        System.out.println("");
    }

    public static void main(String[] args) {
        test(new Base());
        test(new Derived());
    }
}
